{% extends 'admin/change_form.html' %}      {# 继承原来的admin下面的change_form.html文件 #}

{% load i18n admin_urls static admin_modify %}4

{% block object-tools-items %}
    {# 判断当前用户角色 #}
    {% if request.user.is_superuser %}
    <li>
    {% url opts|admin_urlname:'history' original.pk|admin_urlquote as history_url %}
    <a href="{% add_preserved_filters history_url %}"
       class="historylink"
    >
        {% trans "History" %}
    </a>

    </li>
    {# 判断结束符 #}
    {% endif %}

    {% if has_absolute_url %}
    <li>
    <a href="{{ absolute_url }}"
       class="viewsitelink"
    >
        {% trans "View on site" %}
    </a>
    </li>
    {% endif %}
{% endblock %}